#include<iostream>
using namespace std;
const int N = 35;
int a[N], b[N], c[N];
int n, t;
int main()
{
	cin >> n >> t;
	int sum1 = 0, sum2 = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i] >> b[i];
		sum1 += a[i], sum2 += b[i];
		c[i] = b[i] - a[i];
	}
	if (sum1 > t || sum2 < t)cout << "NO" << endl;
	else {
		cout << "YES" << endl;
		t -= sum1;
		//cout << "t==" << t << endl;
		for (int i = 1; i <= n; i++) {
			if (t >= c[i]) {
				a[i] = b[i];
				t -= c[i];
			}
			else {
				a[i] += t;
				break;
			}
		}
		for (int i = 1; i <= n; i++) {
			cout << a[i] << " ";
		}
		cout << endl;
	}
	return 0;
}